当nativeDriver为false时,可以使用._value获取当前动画值。
但是当nativeDriver设置为true时,是否可以获得当前值?
我们有什么解决方法吗?
答案 0 :(得分:1)
像这样使用addListener
ParallaxView
答案 1 :(得分:0)
我想出了一种解决此类情况的方法,其中本机驱动程序破坏了我们的偏移量,并最终使动画跳转了。
创建一个伪动画值(不会用于任何动画),并与原始动画值一起不断更新。最后,当动画结束时(例如衰减,弹簧等),使用伪值设置偏移量和当前角度,如下所示:
use Nesk\Puphpeteer\Puppeteer;
use Nesk\Rialto\Data\JsFunction;
use Nesk\Puphpeteer\Resources\ElementHandle;
public function scrapeFacebookForBirthdays()
{
$cookies = null;
$puppeteer = new Puppeteer();
$browser = $puppeteer->launch([ 'headless' => false, 'slowMo' => 250 ]);
$browser->setUserAgent('Opera/9.80 (Windows NT 6.2; WOW64) Presto/2.12.388 Version/12.17');
$page = $browser->newPage();
//Check if cookies are set or not, if not set it means we have to log in ONCE, but HOW to cjeck for cookies, where to save them?
if (!$cookies)
{
$page->goto("https://www.facebook.com/login", [ 'waitUntil' => "networkidle2" ]);
$page->type("#email", $username, [ 'delay' => 30 ]);
$page->type("#pass", $password, [ 'delay' => 30 ]);
$page->click("#loginbutton");
sleep(5);
$page->waitForNavigation([ 'waitUntil' => "networkidle0" ]);
try
{
echo "success login";
$page->waitFor('[data-click="profile_icon"]');
}
catch (Exception $e)
{
echo "failed to login";
$browser->close();
}
//Where to save cookies for next url scrape??
$cookies = $page->cookies();
}
else
{
//User Already Logged In
$page->setCookie($cookies);
}
}