Neon Clock

Rating: 
5
Your rating: None Average: 5 (7 votes)

This is just a dumb clock with pretty colors. That's it!

I got inspiration for this clock from Daniel Shiffman, who runs The Coding Train YouTube channel. The specific video was "Coding Challenge #74: Clock with p5.js" It turned out p5.js really makes your life easier...

I don't always post silly apps, but when I do, I post the source in GitHub while drinking coffee :)

Screenshots: 

Keywords:

Application versions: 
AttachmentSizeDate
File harbour-neonclock-1.1-1.noarch.rpm42.79 KB31/05/2020 - 23:03
File harbour-neonclock-1.2-1.noarch.rpm42.98 KB01/06/2020 - 21:34
File harbour-neonclock-1.3-1.noarch.rpm43 KB04/06/2020 - 00:30
File harbour-neonclock-1.4-1.noarch.rpm43.46 KB24/04/2021 - 23:53
File harbour-neonclock-1.5-1.noarch.rpm43.64 KB13/04/2022 - 15:40
Changelog: 

1.5-1

  • Add empty Sailjail rule

1.4-1

  • Hide/show the pendulum
  • Hide/show the seconds hand and ring

1.3-1

  • Fix a crash while locking/unlocking the screen (thanks, monich)

1.2-1

  • Increase fps to 30
  • Try to increase performance
  • Click the clock to hide/show menu and title

1.1-1

  • Remove translations
  • Tweak drawing routine
  • Update clock 25 times a second

1.0-1

  • Initial release
  • Hide title and pulley when on landscape
  • Updates clock 15 timer per second

Comments

rob_k's picture

Mesmerizing!

direc85's picture

Haha, thanks!

olmo's picture

nice,
i like it

Markkyboy's picture

Neat, nicely done, I like it :)
Easy to modify!, which is always nice ;)

direc85's picture

Thanks!

slava's picture

Open the app full screen and then pressing power button a few times crashes the app:

Thread 1 "sailfish-qml" received signal SIGSEGV, Segmentation fault.
QOpenGLContext::format (this=this@entry=0x0) at kernel/qopenglcontext.cpp:1096
1096	    Q_D(const QOpenGLContext);
(gdb) bt
#0  QOpenGLContext::format (this=this@entry=0x0) at kernel/qopenglcontext.cpp:1096
#1  0xf030f71a in QQuickContext2D::init (this=0xb98ad138, canvasItem=, args=...) at items/context2d/qquickcontext2d.cpp:4113
#2  0xf02fbf46 in QQuickCanvasItem::initializeContext (this=this@entry=0xb971ab00, context=context@entry=0xb98ad138, args=...) at items/context2d/qquickcanvasitem.cpp:1164
#3  0xf02fc79a in QQuickCanvasItem::createContext (contextType=..., this=0xb971ab00) at /usr/include/qt5/QtCore/qmap.h:326
#4  QQuickCanvasItem::createContext (this=0xb971ab00, contextType=...) at items/context2d/qquickcanvasitem.cpp:1140
#5  0xf02fe074 in QQuickCanvasItem::getContext (this=0xb971ab00, args=0xffd380fc) at items/context2d/qquickcanvasitem.cpp:857
#6  0xf0349d16 in QQuickCanvasItem::qt_static_metacall (_o=_o@entry=0xb971ab00, _c=_c@entry=QMetaObject::InvokeMetaMethod, _id=_id@entry=19, _a=_a@entry=0xffd380e0)
    at .moc/moc_qquickcanvasitem_p.cpp:252
#7  0xf034a0c2 in QQuickCanvasItem::qt_metacall (this=0xb971ab00, _c=QMetaObject::InvokeMetaMethod, _id=19, _a=0xffd380e0) at .moc/moc_qquickcanvasitem_p.cpp:415
#8  0xefbbcdb2 in QQmlVMEMetaObject::metaCall (this=, o=, c=QMetaObject::InvokeMetaMethod, _id=63, a=0xffd380e0) at qml/qqmlvmemetaobject.cpp:876
#9  0xef41d87e in QMetaObject::metacall (object=0xb971ab00, cl=cl@entry=QMetaObject::InvokeMetaMethod, idx=, argv=argv@entry=0xffd380e0) at kernel/qmetaobject.cpp:295
#10 0xefbf43d6 in QQmlObjectOrGadget::metacall (this=this@entry=0xffd38098, type=type@entry=QMetaObject::InvokeMetaMethod, index=, argv=argv@entry=0xffd380e0)
    at ../../include/QtQml/5.6.3/QtQml/private/../../../../../src/qml/qml/ftw/qflagpointer_p.h:323
#11 0xefba02ca in QV4::QObjectMethod::callInternal (this=, callData=0xe9d013a8) at jsruntime/qv4qobjectwrapper.cpp:1865
#12 0xefbb03b0 in QV4::Object::call (d=0xe9d013a8, this=0xe9d013f8) at ../../include/QtQml/5.6.3/QtQml/private/../../../../../src/qml/memory/qv4heap_p.h:90
#13 QV4::Runtime::callActivationProperty (engine=0xb95707e8, nameIndex=, callData=0xe9d013a8) at jsruntime/qv4runtime.cpp:948
#14 0xec11f452 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb) 

I know it's a pure QML app and it should never crash but... Could it be that you're not releasing something or not stopping updates when screen is off and something piles up or... ? Something must be triggering it.

direc85's picture

I can't make it crash on my XA2 Ultra w/3.3.0... I do think the timer keeps requesting redraws when the screen ia locked currently, but it really shouldn't be able to crash anything.

Can you make it crash by starting the app, switching to, say, Settings app and then mashing lock/unlock? That's when both main page and cover page timera are in stopped state.

slava's picture

It only seems to be happening when your app is full screen. And it's not like I'm running some unusual build of Sailfish OS it's easily reproducible with e.g. Sony Xperial XA2 (h4113) running public release 3.3.0.16.

direc85's picture

I'm using XA2 Ultra (3213) with 3.3.0.16, and I just can't reproduce it...

slava's picture

Just submitted a patch - with those changes I can't crash it anymore.

direc85's picture

Patched version released!

Markkyboy's picture

cannot reproduce this on my Jolla1, tried many times, app doesn't crash.

slava's picture

Could be HW adaptation specific, I guess. But I'm consistently seeing crashes on Sony Xperia 10, X and XA2. Run the app full screen, screen off/on, unlock, screen off/on/off/on, unlock and after a few iterations - boom.

It crashes on Jolla C too, with pretty much the same backtrace.

It does look like a Qt or HW adaptation bug. There might still be a workaround, though.

slava's picture

I think this pendulum thing should be taken out - it looks quite jumpy on my X10, making low fps too noticeable. And maybe show/hide page title and pulley menu in portrait mode on tap (or double-tap). Otherwise, great little cool app!

direc85's picture

Nerd snipe time!

I tried to measure the performance, and it looks like my XA2 Ultra is only to output only about 30fps, so this clock is just too performance hungry for full 60fps... I wish there was a way to thread non-overlapping drawing operations within Canvas.onPaint() but it's not meant for that really.

Under all that, there is no reliable way to request a paint every frame to guarantee smooth animation. Fortunately, Canvas does allow using framebuffer object - or trying at least.

Having said that, I managed to squeeze more performance out of it and bumped the fps to 30. How does version 1.2 work for you?

slava's picture

It does look better, indeed! And it's only consuming 30-35% of CPU time, compared to over 90% eaten up by the previous version. Almost perfect now :)

direc85's picture

Awesome, just awesome!