A
download dynapi.fx.bezier.html
Language: NonCode
LOC: 0
Project Info
DynAPI
Server: SourceForge
Type: cvs
...i\dynapi\dynapi3x\examples\
   datasource-paging.db
   datasource.db
   ...cross_frame_access.html
   ...me_access_-_frame1.html
   ...me_access_-_frame2.html
   ...dragdrop-collision.html
   demo.dragicon.html
   demo.dragover.html
   demo.dynlayer-attack.html
   ....dynlayer-dragdraw.html
   demo.oncontentchange.html
   demo.onlocationchange.html
   demo.slideshow.html
   demo.spaceship-circle.html
   demo.spaceship-path.html
   ...emplate.imageframe.html
   ...yndocument-addhtml.html
   ...r-anchor-anchoring.html
   ...dynlayer-anchor-ii.html
   ...-anchor-stretching.html
   ...pi.dynlayer-anchor.html
   ....dynlayer-autosize.html
   ...ynlayer-blackboard.html
   ...pi.dynlayer-create.html
   ...i.dynlayer-destroy.html
   ....dynlayer-relative.html
   ...api.dynlayer-slide.html
   ....api.ext.dragevent.html
   ....ext.inline-widget.html
   dynapi.api.ext.inline.html
   ....api.ext.keyevents.html
   ...pi.ext.tabmanager1.html
   ...pi.ext.tabmanager2.html
   dynapi.api.mouseevent.html
   ...ment.capturehotkey.html
   ...unctions.fadecolor.html
   ...functions.getimage.html
   dynapi.functions.html
   ...ctions.imageloader.html
   ...ions.subclassevent.html
   dynapi.fx.bezier.html
   dynapi.fx.circleanim.html
   dynapi.fx.fader.html
   dynapi.fx.flashsound.html
   dynapi.fx.glideanim.html
   dynapi.fx.hover.html
   dynapi.fx.motionx.html
   dynapi.fx.pathanim.html
   dynapi.fx.slideanim.html
   dynapi.fx.snapx.html
   dynapi.fx.swiper.html
   dynapi.fx.textanim.html
   dynapi.fx.timerx.html
   ...rdermanager-boxfix.html
   ...ordermanager-inner.html
   ...ordermanager-outer.html
   ...rdermanager-random.html
   dynapi.gui.button.html
   dynapi.gui.checkbox.html
   dynapi.gui.explorer.html
   ...i.gui.focusmanager.html
   dynapi.gui.graphics.html
   ...i.gui.groupmanager.html
   ...pi.gui.highlighter.html
   dynapi.gui.htmlbutton.html
   ...i.gui.htmlcalendar.html
   ...i.gui.htmlcheckbox.html
   dynapi.gui.htmlclock.html
   ...ui.htmlcolorpicker.html
   ....gui.htmlcontainer.html
   ...gui.htmldatepicker.html
   ...i.htmldropdownmenu.html
   dynapi.gui.htmlfile.html
   ....gui.htmlhyperlink.html
   ...pi.gui.htmllistbox.html
   ...ui.htmlmenu-images.html
   ...htmlmenu-startmenu.html
   dynapi.gui.htmlmenu.html
   ...ui.htmlprogressbar.html
   ...ui.htmlradiobutton.html
   ...i.gui.htmlrollover.html
   ...i.gui.htmltextarea.html
   ...pi.gui.htmltextbox.html
   dynapi.gui.imageclip.html
   dynapi.gui.knob.html
   dynapi.gui.label.html
   dynapi.gui.list.html
   dynapi.gui.listbox.html
   dynapi.gui.loadpanel.html
   dynapi.gui.marquee.html
   ...i.panelbar-stacker.html
   ...pi.gui.progressbar.html
   ...pi.gui.radiobutton.html
   dynapi.gui.scrollbar.html
   ...emplatemanager-htc.html
   ...ui.templatemanager.html
   dynapi.gui.tree.html
   ....viewpane-explorer.html
   ...viewpane-loadpanel.html
   dynapi.gui.viewpane.html
   dynapi.library-file1.js
   dynapi.library-file2.js
   dynapi.library-load.html
   dynapi.util.cookie.html
   ...atasource-acronyms.html
   ...il.datasource-forms.asp
   ...l.datasource-forms.html
   ...l.datasource-paging.asp
   ....datasource-paging.html
   ...atasource-testfile.html
   ...pi.util.datasource.html
   ...pi.util.filereader.html
   dynapi.util.filereader.xml
   ...ement-dynamic-code.html
   ...ement-dynamic-data.html
   ...til.ioelement-post.html
   ...lement-postresponse.asp
   ...lement-postresponse.php
   ...element-postresponse.pl
   ...lement-soda-calc-js.asp
   ...ement-soda-calc-vbs.asp
   ...ioelement-soda-calc.php
   ...oelement-soda-sync.html
   ...ment-soda-tester-vb.asp
   ...lement-soda-tester.html
   ...element-soda-tester.php
   ...til.ioelement-soda.html
   ...ioelement-testfile.html
   ...il.ioelement-upload.asp
   ...l.ioelement-upload.html
   ...il.ioelement-upload.php
   dynapi.util.ioelement.html
   ....util.stringbuffer.html
   ioelmsrv.jscript.asp
   ioelmsrv.php
   ioelmsrv.pl
   ioelmsrv.pm
   ioelmsrv.soda.jscript.asp
   ioelmsrv.soda.php
   ioelmsrv.soda.pl
   ioelmsrv.soda.vbscript.asp
   ioelmsrv.vbscript.asp
   speedtest.button.html
   speedtest.checkbox.html
   ...est.dynlayer-basic.html
   ...dynlayer-deep_nest.html
   ....dynlayer-oncreate.html
   ...yer-setclass-basic.html
   ...-basic-blueprint_def.js
   ...-basic-blueprint_ns4.js
   ...r.inline-basic-dom.html
   ...layer.inline-basic.html
   ...line-deep_nest-dom.html
   ...etcontentwidth.dom.html
   speedtest.knob.html
   speedtest.listbox.html
   speedtest.radiobutton.html
   speedtest.scrollbar.html
   ...reatewidget.button.html
   upload.asp

<html>
<head>
<title>DynAPI Examples - Bezier Path Animation</title>
<script language="JavaScript" src="../src/dynapi.js"></script>
<script language="Javascript">
dynapi.library.setPath('../src/');
dynapi.library.include('dynapi.api');
dynapi.library.include('dynapi.debug');
dynapi.library.include('dynapi.fx.Thread');
dynapi.library.include('dynapi.fx.Bezier');
</script>
<script language="Javascript">

var path;

var dots = [];
var cps = [];

function drawBezier() {
	clearPage();

	var controlPoints = eval(document.b.cp.value);
	var steps = parseInt(document.b.steps.value);

	// the path includes starting and ending points
	// results in total of steps+1 points along path
	path = Bezier(controlPoints, steps);

	for (var i=0;i<controlPoints.length/2;i++) {
		var x = controlPoints[i*2];
		var y = controlPoints[i*2+1];
		var color = 'red';
		if (i==0 || i==controlPoints.length/2-1) color = 'yellow'
		if (!cps[i]) cps[i] = dynapi.document.addChild(new DynLayer('',x-2,y-2,5,5,color));
		else {
			cps[i].setLocation(x-2,y-2);
			cps[i].setBgColor(color);
		}
		cps[i].setVisible(true);
	}

	for (var i=0;i<path.length/2;i++) {
		var x = path[i*2];
		var y = path[i*2+1];
		if (!dots[i]) dots[i] = dynapi.document.addChild(new DynLayer('',x,y,2,2,'black'));
		else {
			dots[i].setLocation(x-2,y-2);
		}
		dots[i].setVisible(true);
	}
}

var playblock = dynapi.document.addChild(new DynLayer('',0,0,15,15,'red'));
playblock.setVisible(false);
var pathanim = new Thread(playblock);
pathanim.loop = true;

function startAnim() {
	if (path) {
		playblock.setVisible(true);

		var speed = parseInt(document.b.speed.value);
		pathanim.sleep(speed);
		pathanim.play(path);
	}
}
function stopAnim() {
	playblock.setVisible(false);
	pathanim.stop();
}

function clearPage() {
	for (var i=0;i<dynapi.document.children.length;i++) {
		var c = dynapi.document.children[i];
		if (c!=playblock) c.setVisible(false);
	}
}

function setCP(cp) {
	document.b.cp.value = cp;
	drawBezier();
	startAnim();
}

var t="drawBezier();\nstartAnim();\nthis.watch('playblock.getX()');\n"
+"this.watch('playblock.getY()');\n"
+"this.switchMode('watch');";
dynapi.debug.setEvaluate(t);


</script>
</head>
<body bgcolor="#999999">

<form name=b>
Control Points: <input type=text name="cp" value="[200,150, 200,400, 250,100, 500,300]" size=50>
try these <input type=button value="1" onclick="setCP('[200,150, 200,150, 200,150, 400,150, 400,150, 400,150]');">
<input type=button value="2" onclick="setCP('[200,150, 200,150, 400,300]');">
<input type=button value="3" onclick="setCP('[200,200, 400,200, 400,400, 200,400, 200,200]');">
<input type=button value="4" onclick="setCP('[200,200, 200,300, 300,100, 500,200, 300,400, 500,300]');">
<br>
Steps: <input type=text name="steps" value="25" size=4><br>
Speed: <input type=text name="speed" value="40" size=4>ms<br>
<input type=button value="Draw" onclick="drawBezier()"><br>
<input type=button value="Clear Page" onclick="clearPage()"><br>
<input type=button value="Start Animation" onclick="startAnim()"><br>
<input type=button value="Stop Animation" onclick="stopAnim()"><br>
</form>

</body>
</html>

About Koders | Resources | Downloads | Support | Black Duck | Terms of Service | DMCA | Privacy Policy | Contact Us