# writer1

Members

8

0 Neutral

• Rank
Newbie
1. ## For Loop with 2 Timeouts inside

Thank you for this. I can use it to experiment with different options. Since there are a finite number of cycles as well as a finite number of minutes for the exercise, I may end up with the "long way" suggested by your above script. Once "hard-coded" in, it may be my best option. May have more questions as I try to go forward. Again, thank you.
2. ## For Loop with 2 Timeouts inside

Hi, It appears that Opus (the eLearning app that I'm using) can use this scaling function: Scale( Horizontal, Vertical, Time, Wait )// so Vector8.Scale(.5,.5,_DWPub.bar2 * 0.3,) would scale the circle to 150% horizontal and vertical (height and width) over a time duraction based on breaths per minute (BPM)/60* .3 (inhale),// with Wait defaulting to true (so the next line of script will not run until this scaling is completed). After a 500 ms delay, it would run the exhale scaling which would scale the circle back// in twice the duraction as the inhale. Then another 500 ms delay and back t
3. ## For Loop with 2 Timeouts inside

Hi, Thank you for the encouragement. I think where I am stuck is in the adding of 2 timeouts (one for the inhale part of the breath cycle and one for the exhale part of the breath cycle) inside a loop. The breath duration can be one of the scaling parameters in each function: for inhale = _DWPub.bar2 * 0.3, for exhale = _DWPub.bar2 * 0.6. The scaling parameter for inhale (H, W) is .5, .5, for exhale is -.5, -.5. Problem is that there should be a 500 ms delay between inhale and exhale or exhale and inhale. So need to loop: inhale, delay(timeout?), exhale, delay (timeout?) as long as
4. ## For Loop with 2 Timeouts inside

Thank you for this explanation, so I can learn. If I am understanding correctly, then the driver in this model would be the start and end scale size. I'm not sure this can be used, since the start and end is driven by time, cycle duration, not scale amount. Here is an explanation about the timing needed: If the exercise starts at 10 BPM (breaths per minute), then I would want to have the circle expand/contract 10 cycles (twice as long within each cycle for the contraction than for the expansion to correctly mirror "good" breathing). After that one minute at 10 BPM, it would decrease to
5. ## For Loop with 2 Timeouts inside

Apologies for not being clearer, and all of those mistakes in the script. The eLearning software that I am working with uses its own script, which is a variation of ECMA262 JavaScript, an older standard. This script can not be used for an HTML5 type export. So, I am trying to rewrite the old script for this exercise into new JavaScript. Not easy for a beginner like me. What I need to do in the (stress-reducing) exercise is show the student a circle object that, using scaling, looks like breathing: it would expand and contract. They can use it to pace their own breathing. The cycle for
6. ## For Loop with 2 Timeouts inside

Hi, I have beginner skills using JavaScript in HTML5 projects. I use an eLearning software package (Opus) which can generate lessons that use JavaScript to animate objects in exercises. I am trying to animate a circle object and have it scale larger and scale smaller to look like breathing. Since the scaling larger and smaller needs to follow a pattern, I am trying to build a script. So far, if I place a circle object (Vector8) in the center, my script will make the circle expand once, but no contraction cycle, no looping. Here's my script. I am hoping someone can help and suggest how
7. ## Centering Canvas

Hi, Thank you for your reply and helpful suggestions. I have done some more online searching and came up with the following which works: canvas{ border:1px solid black; position: absolute; top: 50%; left: 50%; ; margin-top: -320px;} Seems to work OK.
8. ## Centering Canvas

Hi, I am a beginner so not sure if this should be placed here or in CSS? Based on this example: http://jsfiddle.net/pmw57/as4UR/ ,have a canvas element, 640X640. How do you center this canvas so it appears in the middle of the screen? Currently it is displaying 0,0. Thank you for your help. writer1
×
×
• Create New...