/    Sign up×
Community /Pin to ProfileBookmark

adobe animate javascript or action script?

hi i just signed up because i found a few helpfull answers on here in the last few years 😀

i wanted to create a exe file for a desktop wallpaper with animate and air…
it basically just needs to be a video with animated clouds and real time day and night based on the windows clock…

i already finished the cloud animations and the backgrounds…
now i want to add the code and my problems start to show up…
because i never really coded besides copy paste stuff…
here is the animation (video is the night part – day part is the same just different background )
https://www.youtube.com/watch?v=xPXwlDOCVjo

i found this post wich seems similar to my problem…
https://www.webdeveloper.com/d/194549-loading-different-images-based-on-time-of-day

im not sure if this is correct but i tried to change the code to fit into animate…
i also dont know where to put the code? i basically can put the code on every layer/frame/object…
i tried to use it on the global script…
heres the code i used …

`var DJimages = [ // add path to directory if necessary
“DJimage1.png”,
“DJimage2.png” // NOTE: no comma after last entry];
function TODimage() {
var now = new Date();
hr = now.getHours(); // alert(hr); // for testing
var DJ = 1; // 21:00-06:00
if ((hr >= 6) && (hr < 21)){DJ = 0;} // 06:00-21:00
document.getElementById(‘DJimage’).src = DJimages[DJ];
document.getElementById(‘DJimage’).alt = DJimages[DJ];}`

if i use this code on the global scrip nothing happens in browser preview…
if im not totaly stupid i think one time i managed the images to swtich when changing the windows time…
but i couldnt replicate it again… i almost thought i got it… i may have changed something in the code or some setting inside of animate… after googline for mor im not sure if animate can even use javascript or if the code is different for action script?

after playing around with animate for a while i realised if i just switch the images from day to night fast, it doesnt look good… some kind of fading would be the real way to go… i think the best way to archieve smooth day and night effect is with a extra layer containing a transparent color gardient wich slowly slides from the top to the botton of the background, the slide speed is adjusted to the the win clock – from top to bottom takes 24 hours…
but i think this would be way harder to code (probably not doable for me) i would be happy if i at least get the images to switch…

if anybody could help me out or point me in the right direction would awesome
any help is apreciated
thanks
dave

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@NewYearqOct 23.2021 — This is a nice option, but its usefulness is questionable.
×

Success!

Help @drc85 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 4.26,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...