Giter Site home page Giter Site logo

Background Color Animation about jazzhands HOT 3 CLOSED

ifttt avatar ifttt commented on August 30, 2024
Background Color Animation

from jazzhands.

Comments (3)

gazsp avatar gazsp commented on August 30, 2024

I have the same issue with JazzHands 2.0, although the demo app works fine.

scrollViewDidScroll uses the default implementation from IFTTTAnimatedPagingScrollViewController.

from jazzhands.

gazsp avatar gazsp commented on August 30, 2024

The issue is in IFTTTFilmStrip.m here (see the commented out line):

- (id<IFTTTInterpolatable>)valueAtTime:(CGFloat)time
{
    NSAssert(!self.isEmpty, @"At least one KeyFrame must be set before animation begins.");
    id value;
    NSUInteger indexAfter = [self indexOfKeyframeAfterTime:time];
    if (indexAfter == 0) {
        value = ((IFTTTKeyframe *)self.keyframes[0]).value;
    } else if (indexAfter < self.keyframes.count) {
        IFTTTKeyframe *keyframeBefore = (IFTTTKeyframe *)self.keyframes[indexAfter - 1];
        IFTTTKeyframe *keyframeAfter = (IFTTTKeyframe *)self.keyframes[indexAfter];
        CGFloat progress = [self progressFromTime:keyframeBefore.time toTime:keyframeAfter.time atTime:time withEasingFunction:keyframeBefore.easingFunction];
        if ([keyframeBefore.value respondsToSelector:@selector(interpolateTo:withProgress:)]
//            && [keyframeAfter.value isKindOfClass:[keyframeBefore.value class]]
        ) {
            value = [keyframeBefore.value interpolateTo:keyframeAfter.value withProgress:progress];
        } else {
            value = keyframeBefore.value;
        }
    } else {
        value = ((IFTTTKeyframe *)self.keyframes.lastObject).value;
    }
    return value;
}

This is because [UIColor blackColor] has a class of UIDeviceWhiteColor, where as any other non white / black / grey colours will have a class of UIDeviceRGBColor. This makes the if statement fail, and hence the interpolation.

from jazzhands.

lauraskelton avatar lauraskelton commented on August 30, 2024

@RodolfoAntonici Thanks for pointing out the issue, and @gazsp thanks for the super helpful detective work on the cause!

from jazzhands.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.