window.addEventListener("load", init);
function init() {
var stage = new createjs.Stage("myCanvas");
//
var shape = new createjs.Shape();
stage.addChild(shape);
//
var angleY = 0;
var centerY = stage.canvas.height / 2;
var range = 80;
var speedX = .2;
var speedY = .02;
var px = 0;
shape.graphics.setStrokeStyle(1).beginStroke('#888888').moveTo(0, centerY);
//
createjs.Ticker.addEventListener("tick", handleTick);
function handleTick() {
px += speedX;
var py = centerY + Math.sin(angleY) * range;
angleY += speedY;
//
shape.graphics.lineTo(px, py);
stage.update();
}
createjs.Ticker.timingMode = createjs.Ticker.RAF;
}