MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / PiuImage_set_frameIndex

Function PiuImage_set_frameIndex

modules/piu/MC/colorcell/piuImage.c:285–297  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

283}
284
285void PiuImage_set_frameIndex(xsMachine *the)
286{
287 PiuImage* self = PIU(Image, xsThis);
288 xsIntegerValue frameCount = (*self)->frameCount;
289 if (frameCount > 1) {
290 xsIntegerValue frameIndex = xsToInteger(xsArg(0));
291 if (frameIndex < 0)
292 frameIndex = 0;
293 else if (frameIndex >= frameCount)
294 frameIndex = frameCount - 1;
295 PiuContentSetTime((PiuContent*)self, ((double)frameIndex * PiuContentUseIdle(self)->duration) / (double)frameCount);
296 }
297}
298
299

Callers

nothing calls this directly

Calls 2

PiuContentSetTimeFunction · 0.85
PiuContentUseIdleFunction · 0.85

Tested by

no test coverage detected