Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,44 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).


## [5-r.3] - 2025-02-18

### Added

* Add new motion loop processing that seamlessly connects the start and end points of the loop.
* The `isLooped` variable has been moved from the `CubismMotion` class to the `ACubismMotion` class as `isLoop`.
* Add the setter for `isLoop`, `setLoop(boolean loop)`, to class `ACubismMotion`.
* Add the getter for `isLoop`, `getLoop()`, to class `ACubismMotion`.
* The `isLoopFadeIn` variable was moved from class `CubismMotion` to class `ACubismMotion`.
* Add the setter for `isLoopFadeIn`, `setLoopFadeIn(boolean loopFadeIn)`, to class `ACubismMotion`.
* Add the getter for `isLoopFadeIn`, `getLoopFadeIn()`, to class `ACubismMotion`.
* Add a variable `motionBehavior` for version control to the `CubismMotion` class.

### Changed

* Change the compile and target SDK version of Android OS to 15.0 (API 35).
* Upgrade the version of Android Gradle Plugin from 8.1.1 to 8.6.1.
* Upgrade the version of Gradle from 8.2 to 8.7.
* Change the minimum version of Android Studio to Ladybug(2024.2.1).
* Change the arguments of `CsmMotionSegmentEvaluationFunction.evaluate` from `(float time, int basePointIndex)` to `(final List<CubismMotionPoint> points, final float time)` to align with the Cubism SDK for Native codebase.
* Accordingly, change the implementation of the following methods.
* CubismMotion.LinearEvaluator.evaluate()
* CubismMotion.BezierEvaluator.evaluate()
* CubismMotion.BezierEvaluatorCardanoInterpretation.evaluate()
* CubismMotion.SteppedEvaluator.evaluate()
* CubismMotion.InverseSteppedEvaluator.evaluate()
* CubismMotion.bezierEvaluateBinarySearch()
* Change the access level of `CubismMotionQueueEntry` class to public.

### Deprecated

* Deprecate the following elements due to the change in the variable declaration location.
* `CubismMotion.isLoop(boolean loop)`
* `CubismMotion.isLoop()`
* `CubismMotion.isLoopFadeIn(boolean loopFadeIn)`
* `CubismMotion.isLoopFadeIn()`


## [5-r.2] - 2024-11-07

### Added
Expand Down Expand Up @@ -200,6 +238,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

* New released!


[5-r.3]: https://github.com/Live2D/CubismJavaFramework/compare/5-r.2...5-r.3
[5-r.2]: https://github.com/Live2D/CubismJavaFramework/compare/5-r.1...5-r.2
[5-r.1]: https://github.com/Live2D/CubismJavaFramework/compare/5-r.1-beta.3...5-r.1
[5-r.1-beta.3]: https://github.com/Live2D/CubismJavaFramework/compare/5-r.1-beta.2...5-r.1-beta.3
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.1.1'
classpath 'com.android.tools.build:gradle:8.6.1'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,9 @@ public void setupMotionQueueEntry(
// Record the start time of fade-in
motionQueueEntry.setFadeInStartTime(userTimeSeconds);

final float duration = getDuration();

// Deal with the case where the status is set "end" before it has started.
if (motionQueueEntry.getEndTime() < 0) {
// If duration == -1, loop motion.
float endTime = (duration <= 0)
? -1
: motionQueueEntry.getStartTime() + duration;
motionQueueEntry.setEndTime(endTime);
adjustEndTime(motionQueueEntry);
}
}

Expand Down Expand Up @@ -207,6 +201,42 @@ public void setOffsetTime(float offsetSeconds) {
this.offsetSeconds = offsetSeconds;
}

/**
* Sets whether the motion should loop.
*
* @param loop true to set the motion to loop
*/
public void setLoop(boolean loop) {
isLoop = loop;
}

/**
* Checks whether the motion is set to loop.
*
* @return true if the motion is set to loop; otherwise false.
*/
public boolean getLoop() {
return isLoop;
}

/**
* Sets whether to perform fade-in for looping motion.
*
* @param loopFadeIn true to perform fade-in for looping motion
*/
public void setLoopFadeIn(boolean loopFadeIn) {
isLoopFadeIn = loopFadeIn;
}

/**
* Checks the setting for fade-in of looping motion.
*
* @return true if fade-in for looping motion is set; otherwise false.
*/
public boolean getLoopFadeIn() {
return isLoopFadeIn;
}

/**
* Check for event firing.
* The input time reference is set to zero at the called motion timing.
Expand Down Expand Up @@ -305,6 +335,17 @@ protected abstract void doUpdateParameters(
CubismMotionQueueEntry motionQueueEntry
);

protected void adjustEndTime(CubismMotionQueueEntry motionQueueEntry) {
final float duration = getDuration();

// duration == -1 の場合はループする
final float endTime = (duration <= 0)
? -1
: motionQueueEntry.getStartTime() + duration;

motionQueueEntry.setEndTime(endTime);
}

/**
* 指定時間の透明度の値を返す。
* NOTE: 更新後の値を取るには`updateParameters()` の後に呼び出す。
Expand All @@ -331,6 +372,20 @@ protected float getModelOpacityValue() {
* Start time for motion playback[s]
*/
protected float offsetSeconds;

/**
* Enable/Disable loop
*/
protected boolean isLoop;
/**
* flag whether fade-in is enabled at looping. Default value is true.
*/
protected boolean isLoopFadeIn = true;

/**
* The previous state of `_isLoop`.
*/
protected boolean previousLoopState = isLoop;
/**
* List of events that have fired
*/
Expand Down
Loading