try clock with separate digit images with no overlayed tube wiring.

and now due to the change i get to flicker the digits into life and
fade them out. yay!



SVN revision: 79468
This commit is contained in:
Carsten Haitzler 2012-11-20 11:17:24 +00:00
parent 113d9dde6f
commit e415356559
15 changed files with 139 additions and 51 deletions

View File

@ -164,6 +164,7 @@ img/digit_8.png \
img/digit_9.png \
img/digit_am.png \
img/digit_na.png \
img/digit_nm.png \
img/digit_pm.png \
img/dot_pattern.png \
img/downlight_glow.png \

View File

@ -2,6 +2,7 @@ group { name: "e/modules/clock/digital";
min: 64 16;
max: 512 128;
images.image: "digit_na.png" COMP;
images.image: "digit_nm.png" COMP;
images.image: "digit_0.png" COMP;
images.image: "digit_1.png" COMP;
images.image: "digit_2.png" COMP;
@ -16,22 +17,8 @@ group { name: "e/modules/clock/digital";
images.image: "digit_pm.png" COMP;
images.image: "hole_tiny.png" COMP;
script {
public do_seconds, do_24h, do_date;
new tick_timer;
public do_seconds, do_24h, do_date, tick_timer;
valset(id, v) {
if ((v >= 0) && (v <= 9)) {
new buf[20];
snprintf(buf, 20, "%i", v);
set_state(id, buf, 0.0);
} else {
set_state(id, "default", 0.0);
}
}
apvalset(id, pm) {
if (pm) set_state(id, "active", 0.0);
else set_state(id, "default", 0.0);
}
evalsize() {
new do24h, dosec, v[14], i, tot, mul;
new parts[] = {
@ -49,7 +36,7 @@ group { name: "e/modules/clock/digital";
mul = 3;
}
for (i = 0; i < 14; i += 2) {
for (i = 12; i < 14; i += 2) {
custom_state(parts[i], "default", 0.0);
}
v[0] = 0; v[1] = 2; v[2] = 2; v[3] = 4; // hrs
@ -102,7 +89,23 @@ group { name: "e/modules/clock/digital";
}
clock_cb(0);
}
valset(name[], v) {
new buf[20], i;
for (i = 0; i < 10; i++) {
if (i == v) {
snprintf(buf, 20, "show,%s-%i", name, i);
}
else {
snprintf(buf, 20, "hide,%s-%i", name, i);
}
emit(buf, "c");
}
}
apvalset(id, pm) {
if (pm) set_state(id, "active", 0.0);
else set_state(id, "default", 0.0);
}
public clock_cb(val) {
new year, month, day, yearday, weekday, hour, minute;
new Float:second;
@ -115,8 +118,8 @@ group { name: "e/modules/clock/digital";
v = round(second);
tim = timer(1.0 - (second - v), "clock_cb", 1);
// set seconds to v
valset(PART:"s0", v / 10);
valset(PART:"s1", v % 10);
valset("s0", v / 10);
valset("s1", v % 10);
}
else {
tim = timer(60.0 - (second), "clock_cb", 1);
@ -124,14 +127,14 @@ group { name: "e/modules/clock/digital";
set_int(tick_timer, tim);
// set minutes to minute
valset(PART:"m0", minute / 10);
valset(PART:"m1", minute % 10);
valset("m0", minute / 10);
valset("m1", minute % 10);
// set hours to hour
do24h = get_int(do_24h);
if (do24h) {
valset(PART:"h0", hour / 10);
valset(PART:"h1", hour % 10);
valset("h0", hour / 10);
valset("h1", hour % 10);
}
else {
new pm;
@ -147,8 +150,8 @@ group { name: "e/modules/clock/digital";
// make after midnight be 12:XX AM :)
if (hour == 0) hour = 12;
}
valset(PART:"h0", hour / 10);
valset(PART:"h1", hour % 10);
valset("h0", hour / 10);
valset("h1", hour % 10);
apvalset(PART:"ap", pm);
}
}
@ -298,43 +301,60 @@ group { name: "e/modules/clock/digital";
image.normal: "hole_tiny.png";
}
}
#define DIGIT(_NAME, _TO) \
#define ELEM(_NAME, _TO, _DIGIT) \
part { name: _NAME; \
description { state: "default" 0.0; \
rel1.to: _TO; rel2.to: _TO; \
aspect: (52/72) (52/72); aspect_preference: BOTH; \
image.normal: "digit_na.png"; \
image.normal: "digit_"_DIGIT".png"; \
visible: 0; \
color: 255 255 255 0; \
} \
description { state: "active" 0.0; \
inherit: "default" 0.0; \
visible: 1; \
color: 255 255 255 255; \
} \
description { state: "0" 0.0; inherit: "default" 0.0; image.normal: "digit_0.png"; } \
description { state: "1" 0.0; inherit: "default" 0.0; image.normal: "digit_1.png"; } \
description { state: "2" 0.0; inherit: "default" 0.0; image.normal: "digit_2.png"; } \
description { state: "3" 0.0; inherit: "default" 0.0; image.normal: "digit_3.png"; } \
description { state: "4" 0.0; inherit: "default" 0.0; image.normal: "digit_4.png"; } \
description { state: "5" 0.0; inherit: "default" 0.0; image.normal: "digit_5.png"; } \
description { state: "6" 0.0; inherit: "default" 0.0; image.normal: "digit_6.png"; } \
description { state: "7" 0.0; inherit: "default" 0.0; image.normal: "digit_7.png"; } \
description { state: "8" 0.0; inherit: "default" 0.0; image.normal: "digit_8.png"; } \
description { state: "9" 0.0; inherit: "default" 0.0; image.normal: "digit_9.png"; } \
}
#define DIGITC(_NAME, _TO, _CLIP) \
#define DIGIT(_NAME, _TO) \
ELEM(_NAME"-0", _TO, "0") \
ELEM(_NAME"-1", _TO, "1") \
ELEM(_NAME"-2", _TO, "2") \
ELEM(_NAME"-3", _TO, "3") \
ELEM(_NAME"-4", _TO, "4") \
ELEM(_NAME"-5", _TO, "5") \
ELEM(_NAME"-6", _TO, "6") \
ELEM(_NAME"-7", _TO, "7") \
ELEM(_NAME"-8", _TO, "8") \
ELEM(_NAME"-9", _TO, "9")
#define ELEMC(_NAME, _TO, _DIGIT, _CLIP) \
part { name: _NAME; \
clip_to: _CLIP; \
description { state: "default" 0.0; \
rel1.to: _TO; rel2.to: _TO; \
aspect: (52/72) (52/72); aspect_preference: BOTH; \
image.normal: "digit_na.png"; \
image.normal: "digit_"_DIGIT".png"; \
visible: 0; \
color: 255 255 255 0; \
} \
description { state: "active" 0.0; \
inherit: "default" 0.0; \
visible: 1; \
color: 255 255 255 255; \
} \
description { state: "0" 0.0; inherit: "default" 0.0; image.normal: "digit_0.png"; } \
description { state: "1" 0.0; inherit: "default" 0.0; image.normal: "digit_1.png"; } \
description { state: "2" 0.0; inherit: "default" 0.0; image.normal: "digit_2.png"; } \
description { state: "3" 0.0; inherit: "default" 0.0; image.normal: "digit_3.png"; } \
description { state: "4" 0.0; inherit: "default" 0.0; image.normal: "digit_4.png"; } \
description { state: "5" 0.0; inherit: "default" 0.0; image.normal: "digit_5.png"; } \
description { state: "6" 0.0; inherit: "default" 0.0; image.normal: "digit_6.png"; } \
description { state: "7" 0.0; inherit: "default" 0.0; image.normal: "digit_7.png"; } \
description { state: "8" 0.0; inherit: "default" 0.0; image.normal: "digit_8.png"; } \
description { state: "9" 0.0; inherit: "default" 0.0; image.normal: "digit_9.png"; } \
}
#define DIGITC(_NAME, _TO, _CLIP) \
ELEMC(_NAME"-0", _TO, "0", _CLIP) \
ELEMC(_NAME"-1", _TO, "1", _CLIP) \
ELEMC(_NAME"-2", _TO, "2", _CLIP) \
ELEMC(_NAME"-3", _TO, "3", _CLIP) \
ELEMC(_NAME"-4", _TO, "4", _CLIP) \
ELEMC(_NAME"-5", _TO, "5", _CLIP) \
ELEMC(_NAME"-6", _TO, "6", _CLIP) \
ELEMC(_NAME"-7", _TO, "7", _CLIP) \
ELEMC(_NAME"-8", _TO, "8", _CLIP) \
ELEMC(_NAME"-9", _TO, "9", _CLIP)
#define TAG(_NAME, _TO, _CLIP) \
part { name: _NAME; \
clip_to: _CLIP; \
@ -348,7 +368,35 @@ group { name: "e/modules/clock/digital";
image.normal: "digit_pm.png"; \
} \
}
#define BASE(_NAME, _BASE, _IMG) \
part { name: _NAME; \
description { state: "default" 0.0; \
rel1.to: _BASE; \
rel2.to: _BASE; \
image.normal: _IMG; \
color: 255 255 255 128; \
} \
}
#define BASEC(_NAME, _CLIP, _BASE, _IMG) \
part { name: _NAME; \
clip_to: _CLIP; \
description { state: "default" 0.0; \
rel1.to: _BASE; \
rel2.to: _BASE; \
image.normal: _IMG; \
color: 255 255 255 128; \
} \
}
BASE ("ha", "h0-0", "digit_na.png")
BASE ("hb", "h1-0", "digit_na.png")
BASE ("ma", "m0-0", "digit_na.png")
BASE ("mb", "m1-0", "digit_na.png")
BASEC("sa", "secclip", "s0-0", "digit_na.png")
BASEC("sb", "secclip", "s1-0", "digit_na.png")
BASEC("aa", "ampmclip", "ap", "digit_nm.png")
DIGIT ("h0", "hours1")
DIGIT ("h1", "hours2")
DIGIT ("m0", "mins1")
@ -357,7 +405,13 @@ group { name: "e/modules/clock/digital";
DIGITC("s1", "secs2", "secclip")
TAG("ap", "ampm", "ampmclip")
#undef TAG
#undef DIGIT
#undef TAG
#undef ELEM
#undef ELEMC
#undef BASE
#undef BASEC
#undef DIGIT
#undef DIGITC
part { name: "e.text.today"; type: TEXT;
effect: GLOW;
@ -388,7 +442,7 @@ group { name: "e/modules/clock/digital";
program {
signal: "load"; source: "";
script {
clock_cb(0);
reset();
}
}
program {
@ -439,6 +493,39 @@ group { name: "e/modules/clock/digital";
reset();
}
}
#define DIGPRG(_NAME) \
program { \
signal: "show,"_NAME; source: "c"; \
action: STATE_SET "active" 0.0; \
transition: BOUNCE 0.3 0.5 2; \
target: _NAME; \
} \
program { \
signal: "hide,"_NAME; source: "c"; \
action: STATE_SET "default" 0.0; \
transition: DECELERATE 0.3; \
target: _NAME; \
}
#define DIGPRGS(_NAME) \
DIGPRG(_NAME"-0") \
DIGPRG(_NAME"-1") \
DIGPRG(_NAME"-2") \
DIGPRG(_NAME"-3") \
DIGPRG(_NAME"-4") \
DIGPRG(_NAME"-5") \
DIGPRG(_NAME"-6") \
DIGPRG(_NAME"-7") \
DIGPRG(_NAME"-8") \
DIGPRG(_NAME"-9")
DIGPRGS("h0")
DIGPRGS("h1")
DIGPRGS("m0")
DIGPRGS("m1")
DIGPRGS("s0")
DIGPRGS("s1")
#undef DIGPRG
#undef DIGPRGS
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.2 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

After

Width:  |  Height:  |  Size: 523 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.0 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.4 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.6 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.2 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.0 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 924 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB