MCPcopy Index your code
hub / github.com/methodofaction/Method-Draw / animateCanvasSize

Function animateCanvasSize

src/js/method-draw.js:1411–1427  ·  view source on GitHub ↗
(timestamp)

Source from the content-addressed store, hash-verified

1409 var start = Date.now();
1410 var duration = 1000;
1411 var animateCanvasSize = function(timestamp) {
1412 var progress = Date.now() - start;
1413 var tick = progress / duration;
1414 tick = (Math.pow((tick-1), 3) +1);
1415 w.value = (dims[0] - diff_w + (tick*diff_w)).toFixed(0);
1416 h.value = (dims[1] - diff_h + (tick*diff_h)).toFixed(0);
1417 changeCanvasSize();
1418 if (tick >= 1) {
1419 var res = svgCanvas.getResolution()
1420 $('#canvas_width').val(res.w.toFixed())
1421 $('#canvas_height').val(res.h.toFixed())
1422 $('#resolution_label').html("<div class='pull'>" + res.w + "<span>×</span></br>" + res.h + "</div>");
1423 }
1424 else {
1425 requestAnimationFrame(animateCanvasSize)
1426 }
1427 }
1428 animateCanvasSize()
1429
1430 }

Callers 1

method-draw.jsFile · 0.70

Calls 2

changeCanvasSizeFunction · 0.85
$Function · 0.85

Tested by

no test coverage detected