Welcome to TalkGraphics.com
Results 1 to 9 of 9
  1. #1
    Join Date
    Apr 2012
    Location
    SW England
    Posts
    17,803

    Lightbulb anime.js - Xara Watch Re-imagined

    In early Xara days, Xara included illustrations in their component library.

    Some might recognise this, with one or two slight changes; https://shared.xara.com/x7x8xzWgLu

    Not all animations need to be flashy.

    Acorn

    Afternote: I have got the maths wrong for the minute hand - working on it.
    Perhaps not back in a mo though.
    Acorn - installed Xara software: Cloud+/Pro+ and most others back through time (to CC's Artworks). Contact for technical remediation/consultancy for your web designs.
    When we provide assistance, your responses are valuable as they benefit the community. TG Nuggets you might like. Report faults: Xara Cloud+/Pro+/Magix Legacy; Xara KB & Chat

  2. #2
    Join Date
    Apr 2012
    Location
    SW England
    Posts
    17,803

    Default Re: anime.js - Xara Watch Re-imagined

    In the end, it was easier to drop this approach and go back to JavaScript basics.

    Essentially the seconds steps() is replaced with a setTimeout() call of a second.
    All you need then do is calculate the angles of the three hands and rotate them incrementally every second.

    The JavaScript code then simplifies to :

    <script>
    var sh = document.querySelector('.secondHand');
    var mh = document.querySelector('.minuteHand');
    var hh = document.querySelector('.hourHand');

    var angS;
    var angM;
    var angH;
    function startTime() {
    const today = new Date();
    let h = today.getHours();
    let m = today.getMinutes();
    let s = today.getSeconds();
    angS = 6 * s;
    angM = 6 * m + s / 10;
    angH = h%12 * 30 + angM / 12;
    sh.style.transform = 'rotate(' + angS + 'deg)';
    mh.style.transform = 'rotate(' + angM + 'deg)';
    hh.style.transform = 'rotate(' + angH + 'deg)';
    setTimeout(startTime, 1000);
    }

    startTime();
    </script>

    The new Clock is here: https://shared.xara.com/inYj3EIGpy

    I'll leave you to work out how I made the hands have a rotational symmetry.

    The design file: JS - Simpler Xara Watch Re-imagined.xar

    Acorn
    Last edited by Acorn; 25 May 2022 at 05:03 PM.
    Acorn - installed Xara software: Cloud+/Pro+ and most others back through time (to CC's Artworks). Contact for technical remediation/consultancy for your web designs.
    When we provide assistance, your responses are valuable as they benefit the community. TG Nuggets you might like. Report faults: Xara Cloud+/Pro+/Magix Legacy; Xara KB & Chat

  3. #3
    Join Date
    Aug 2000
    Location
    Harwich, Essex, England
    Posts
    21,910

    Default Re: anime.js - Xara Watch Re-imagined

    Argh! I was still trying to work out the problem with your first xar file were the minute hand didn't equate to the correct setting!
    Egg

    Intel i7 - 4790K Quad Core + 16 GB Ram + NVIDIA Geforce GTX 1660 Graphics Card + MSI Optix Mag321 Curv monitor
    + Samsung 970 EVO Plus 500GB SSD + 232 GB SSD + 250 GB SSD portable drive + ISP = BT + Web Hosting = TSO Host

  4. #4
    Join Date
    Apr 2012
    Location
    SW England
    Posts
    17,803

    Default Re: anime.js - Xara Watch Re-imagined

    Quote Originally Posted by Egg Bramhill View Post
    Argh! I was still trying to work out the problem with your first xar file were the minute hand didn't equate to the correct setting!
    Sorry about that Egg. Do persist.

    I have added a modulus 12 calculation to the hour statement: angleHour = current.getHours()%12 * 30 + angleMinute / 12;
    I think the angleMinute / 12 part has to be wrong.

    I abandoned it as the maths was iffy, the CPU usage was excessive and the alternative is simpler.

    Acorn
    Acorn - installed Xara software: Cloud+/Pro+ and most others back through time (to CC's Artworks). Contact for technical remediation/consultancy for your web designs.
    When we provide assistance, your responses are valuable as they benefit the community. TG Nuggets you might like. Report faults: Xara Cloud+/Pro+/Magix Legacy; Xara KB & Chat

  5. #5
    Join Date
    Jul 2007
    Location
    Brockville, Ontario, Canada.
    Posts
    4,619

    Default Re: anime.js - Xara Watch Re-imagined

    The first version, was correct all the time.

    The second version seems to pull the time when it's invoked, but does NOT seem to show the current time constantly. It doesn't update.
    Keith
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    There are 10 types of people in this world .... Those who understand binary, and those who don't.

  6. #6
    Join Date
    Apr 2012
    Location
    SW England
    Posts
    17,803

    Default Re: anime.js - Xara Watch Re-imagined

    Quote Originally Posted by ss-kalm View Post
    The first version, was correct all the time.
    The second version seems to pull the time when it's invoked, but does NOT seem to show the current time constantly. It doesn't update.
    Keith, I disagreed on the first.
    If you press the button, there is a minute hand jump.

    On the second, i think Xara blocks long-running scripts.
    I included the design file as it run perfectly locally.
    Here it it published to Xara Hosting (Magix) instead: http://acorn.xara.hosting/Tick-tock/

    I am glad you are interested.

    Acorn
    Acorn - installed Xara software: Cloud+/Pro+ and most others back through time (to CC's Artworks). Contact for technical remediation/consultancy for your web designs.
    When we provide assistance, your responses are valuable as they benefit the community. TG Nuggets you might like. Report faults: Xara Cloud+/Pro+/Magix Legacy; Xara KB & Chat

  7. #7
    Join Date
    Dec 2006
    Location
    Melfort, Saskatchewan Canada
    Posts
    1,008

    Default Re: anime.js - Xara Watch Re-imagined

    Cool @acorn. Maybe someday, I’ll be half a coder, and make one myself. Awesome creativity.
    Bill Wood
    Charity Web Design
    XARA Pro+. WD17, Designer 17. Premium packages.

  8. #8
    Join Date
    Aug 2000
    Location
    Harwich, Essex, England
    Posts
    21,910

    Default Re: anime.js - Xara Watch Re-imagined

    Okay Acorn, this was a struggle but I've managed to finish my watch.

    It was based on a watch that I took off my wrist over 30 years ago when I swallowed the anchor. I've never worn it since. In fact I didn't even know I'd lost it until I looked for it to base the drawing on.

    The watch was an analogue/digital combination. The analogue part was fairly small but with my eye site then I had no difficulty reading it.

    So okay, without the original I've created my version but it's nothing like my old one. This one looks far more like an iWatch than the one I disgarded in 1991. But I was more interested in creating a better digital version than the one I had. I wanted to show the day, month and year in full as well having a suffix on the date. Also the time-zone (currently Grenwich Mean Time - GMT).

    I unashamedly plagerised your 're-imagened' version. I altered the second hand as it was far too small at this size.

    I also had problems intergrating your
    const today = new Date();
    into my digital script so I cheated and loaded mine as a webpage in an iframe.

    I'd like to find a better LCD font and also be able to alter the text-styles in my divs but that's beyond me at present.

    Thanks for the inspiration

    LINK
    Last edited by Egg Bramhill; 31 May 2022 at 03:01 AM.
    Egg

    Intel i7 - 4790K Quad Core + 16 GB Ram + NVIDIA Geforce GTX 1660 Graphics Card + MSI Optix Mag321 Curv monitor
    + Samsung 970 EVO Plus 500GB SSD + 232 GB SSD + 250 GB SSD portable drive + ISP = BT + Web Hosting = TSO Host

  9. #9
    Join Date
    Apr 2012
    Location
    SW England
    Posts
    17,803

    Default Re: anime.js - Xara Watch Re-imagined

    Egg, nice watch. Can't help with the font.

    You code seems to load a JavaScript instance for the timing twice, just above your IFRAME and at the body bottom.

    Acorn
    Acorn - installed Xara software: Cloud+/Pro+ and most others back through time (to CC's Artworks). Contact for technical remediation/consultancy for your web designs.
    When we provide assistance, your responses are valuable as they benefit the community. TG Nuggets you might like. Report faults: Xara Cloud+/Pro+/Magix Legacy; Xara KB & Chat

 

 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •