Forum Discussion
KythrieSilva-cd
3 years agoCommunity Member
Can you draw a line with Javascript in Storyline 360?
Hi, Is it possible to draw a line on the screen using JavaScript in Storyline 360?
I'm working on a statistics example where I want to draw a regression line on a scatterplot. The learner can add ...
MathNotermans-9
Community Member
Info about Canvas and drawing on it is to be found abundantly on the web.
Like this..
https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/moveTo
The default values when creating a Canvas by script are small ( 200x200 or some ).
Setting those values at creation to fullscreen size and it will show lines as long as you want.
canv.width = window.innerWidth;
canv.height = window.innerHeight;
Then you can do whatever wanted. However as you can see in my sample the 'px'- values of Storyline for sure mismatch with Canvas units. As they are different. So your best bet probably is a calculation or using percentages.
ChrisCurry
2 years agoCommunity Member
Awesome! Thanks so much for the info!