Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
6 changes: 6 additions & 0 deletions android/libpag/src/main/java/org/libpag/PAGLayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,12 @@ public Matrix getTotalMatrix() {
*/
public native void setExcludedFromTimeline(boolean value);

/**
* Set the alpha of the layer, which will be concatenated to the current animation opacity for
* displaying.
*/
public native void setAlpha(float value);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个属性读写要成对,把alpha读取属性也要暴露出来。


private native void nativeRelease();

protected long nativeContext;
Expand Down
10 changes: 10 additions & 0 deletions src/platform/android/JPAGLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -297,4 +297,14 @@ PAG_API void Java_org_libpag_PAGLayer_setExcludedFromTimeline(JNIEnv* env, jobje

pagLayer->setExcludedFromTimeline(value);
}

PAG_API void Java_org_libpag_PAGLayer_setAlpha(JNIEnv* env, jobject thiz,
jfloat value){
auto pagLayer = GetPAGLayer(env, thiz);
if(pagLayer == nullptr){
return;
}

pagLayer->setAlpha(value);
}
}
6 changes: 6 additions & 0 deletions src/platform/cocoa/PAGLayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,4 +165,10 @@ PAG_API @interface PAGLayer : NSObject
*/
- (void)setExcludedFromTimeline:(BOOL)value;

/**
* Set the alpha of the layer, which will be concatenated to the current animation opacity for
* displaying.
*/
- (void)setAlpha:(float)value;

@end
4 changes: 4 additions & 0 deletions src/platform/cocoa/PAGLayer.m
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@ - (void)setExcludedFromTimeline:(BOOL)value {
[(PAGLayerImpl*)_impl setExcludedFromTimeline:value];
}

- (void)setAlpha:(float)value{
[(PAGLayerImpl*)_impl setAlpha:value];
}

- (void)dealloc {
[_impl release];
[super dealloc];
Expand Down
2 changes: 2 additions & 0 deletions src/platform/cocoa/private/PAGLayerImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,6 @@

- (void)setExcludedFromTimeline:(BOOL)value;

- (void)setAlpha:(float)value;

@end
4 changes: 4 additions & 0 deletions src/platform/cocoa/private/PAGLayerImpl.mm
Original file line number Diff line number Diff line change
Expand Up @@ -254,4 +254,8 @@ - (void)setExcludedFromTimeline:(BOOL)value {
_pagLayer->setExcludedFromTimeline(value);
}

- (void)setAlpha:(float)value {
_pagLayer->setAlpha(value);
}

@end
Loading