Sophie So, if it’s 20 blue tiles tall, it’s 3 times 20, plus 2. Now we can work out how many tiles there are in anypattern we want, just by finding the rule, which is 3 times N, plus 2, or 3N+2! If we don't know how many tiles there are in each blue column, we cancall that the Nth, or Unknown.Īnd then we add the 2 white. Well, our blue rows are always 3 tiles wide. So what if we want to make a really big pattern? How do we know how many tiles we need in total? 2 blue rows, times 3, plus 2 white is 8 tiles.3 blue, times 3, plus 2 white, is 11 tiles! And so on! 1 blue row, times 3, plus 2 white is 5 tiles. Mathsmutt: Ok, let's look at the patterns again. So, now you can work any number in the sequence! Mathsmutt: Yup! And that means it’s connected to the 3 timestable. See? 5 tiles, 8 tiles, 11 tiles, 14 tiles. And the number of tiles at the bottom of each one increases by the same amount each time. Let's make some pretty patterns! Ta da! My patterns are always 3 wide, with 2 tiles on the top. ![]() Mathsmutt Ok, this is just like your homework. Mathsmutt: Come on! Let’s go see if we can help!ĭad: Oh I give up, Sophie. Sophie: No, Mathsmutt! Working here with you two is impossible! With Dad constantly banging, I’m never going to get my homework done. Local targetSequence = NumberSequence.Mathsmutt: Come on Sophie, linear sequences aren’t impossible! Local numberSequence = objectToUpdate - don't change ObjectToUpdate = NumberSequence.new(newKeypoints) Table.insert(newKeypoints, NumberSequenceKeypoint.new(originalTime, targetValue, targetValue)) ![]() Local newNumberSequence = updateNumberSequence(ta) Local ta = game.TweenService:GetValue(t, easeStyle, easeDirection) Table.insert(newKeypoints, NumberSequenceKeypoint.new(originalTime, newValue, newEnvelope))įor t = 0, 1, 1 / (smoothness * timeTaken) do Local newEnvelope = lerp(originalEnvelopes, targetEnvelope, progress) Local newValue = lerp(originalValues, targetValue, progress) Local targetEnvelope = targetKeypoints.Envelope Local targetValue = targetKeypoints.Value If timeDifference < closestTimeDifference then Local timeDifference = math.abs(originalTime - targetKeypoint.Time) Local closestTimeDifference = math.abs(originalTime - targetKeypoints.Time)įor j, targetKeypoint in ipairs(targetKeypoints) do To find the 1st term, put n 1 into the formula, to find the 4th term, replace the ns by 4s: 4th term 2 × 4 8. Such sequences can be expressed in terms of the nth term of the sequence. Local function updateNumberSequence(progress)įor i, originalTime in ipairs(originalTimes) do Number Number Sequences Number Sequences. ![]() ![]() Table.insert(originalEnvelopes, keypoint.Envelope) Table.insert(originalValues, keypoint.Value) Table.insert(originalTimes, keypoint.Time) Local targetKeypoints = targetSequence.Keypoints Local keypoints = numberSequence.Keypoints Local function tweenNumberSequence(numberSequence, targetSequence, smoothness, timeTaken, objectToUpdate, propertyName, easeStyle, easeDirection)Īssert(numberSequence and typeof(numberSequence) = "NumberSequence", "Invalid numberSequence")Īssert(targetSequence and typeof(targetSequence) = "NumberSequence", "Invalid targetSequence")Īssert(smoothness and type(smoothness) = "number" and smoothness > 0, "Invalid smoothness")Īssert(timeTaken and type(timeTaken) = "number" and timeTaken > 0, "Invalid timeTaken")Īssert(type(objectToUpdate) = "userdata", "Invalid objectToUpdate")Īssert(propertyName and type(propertyName) = "string", "Invalid propertyName") Script yields to function to cancel this you can just do: task.spawn(tweenNumberSequence, numberSequence, targetSequence, smoothness, timeTaken, objectToUpdate, propertyName, easeStyle, easeDirection) Tweens to the nearest timestamp value but doesn’t change the original timestamp I was trying to tween number sequences and I found out that you cannot, not even the keypoints, so I just made one because nobody else did!
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |